﻿@using XHouse.Model.Aparatos
@using XHouseWeb.App_Code
@model TipoAparato

@{
    ViewBag.Title = "Nuevo Tipo de Aparato";
}



<div class="row">
<div class="col-xs-12 col-md-10 col-md-offset-1">
    <div class="page-header">
        <h3>Nuevo Tipo de Aparato</h3>
    </div>
    @using (Html.BeginForm(null, null, FormMethod.Post, new {@class = "form-horizontal", @role = "form"}))
    {
        if (ViewData.ModelState != null && !ViewData.ModelState.IsValid)
        {

            <div class="alert alert-danger alert-dismissable">
                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                @Html.Raw(HttpUtility.HtmlDecode((Html.ValidationSummary(false, "Errores:") ?? (object) "").ToString()))
            </div>
        }

        //@Html.HiddenFor(model => model.Id)


        <div class="form-group @(Html.ViewData.ModelState.IsValidField(Html.IdFor(model => model.Nombre).ToString()) ? null : "has-error")">
            <label for="Nombre" class="col-lg-2 control-label">Nombre</label>
            <div class="col-lg-3">
                @Html.TextBoxFor(model => model.Nombre, new {@class = "form-control"})
            </div>

        </div>
        <div class="form-group @(Html.ViewData.ModelState.IsValidField(Html.IdFor(model => model.Descripcion).ToString()) ? null : "has-error")">
            <label for="Descripcion" class="col-lg-2 control-label">Descripción</label>
            <div class="col-lg-3">
                @Html.TextBoxFor(model => model.Descripcion, new {@class = "form-control"})
            </div>

        </div>
        <div class="form-group">
            <div class="col-lg-offset-2 col-lg-3">
                <div class="checkbox">
                    <label>
                        @Html.CheckBoxFor(model => model.Habilitado) Habilitado
                    </label>
                </div>
            </div>
        </div>

        <div class="form-group @(Html.ViewData.ModelState.IsValidField(Html.IdFor(model => model.Operacion).ToString()) ? null : "has-error")">
            <label for="Tipo" class="col-lg-2 control-label">Operación</label>
            <div class="col-lg-3">
                @Html.DropDownListFor(model => model.Operacion, TipoOperacion.Binario.ToSelectList(), new {@class = "form-control"})
            </div>
        </div>

        <div class="form-group @(Html.ViewData.ModelState.IsValidField(Html.IdFor(model => model.RangoTopeInferior).ToString()) ? null : "has-error")">
            <label for="RangoTopeInferior" class="col-lg-2 control-label">Rango Tope Inferior</label>
            <div class="col-lg-3">
                @Html.TextBoxFor(model => model.RangoTopeInferior, new {@class = "form-control"})
            </div>

        </div>

        <div class="form-group @(Html.ViewData.ModelState.IsValidField(Html.IdFor(model => model.RangoTopeSuperior).ToString()) ? null : "has-error")">
            <label for="RangoTopeSuperior" class="col-lg-2 control-label">Rango Tope Superior</label>
            <div class="col-lg-3">
                @Html.TextBoxFor(model => model.RangoTopeSuperior, new {@class = "form-control"})
            </div>

        </div>

        <div class="form-group @(Html.ViewData.ModelState.IsValidField(Html.IdFor(model => model.Conexion).ToString()) ? null : "has-error")">
            <label for="Tipo" class="col-lg-2 control-label">Conexión</label>
            <div class="col-lg-3">
                @Html.DropDownListFor(model => model.Conexion, TipoConexion.Entrada.ToSelectList(), new {@class = "form-control"})
            </div>
        </div>

        <div class="form-group">
            <div class="col-lg-offset-2 col-lg-3">
                <div class="checkbox">
                    <label>
                        @Html.CheckBoxFor(model => model.PuedeApagarse) Puede Apagarse
                    </label>
                </div>
            </div>
        </div>

        <div class="form-group @(Html.ViewData.ModelState.IsValidField(Html.IdFor(model => model.EstadoApagado).ToString()) ? null : "has-error")">
            <label for="EstadoApagado" class="col-lg-2 control-label">Estado Apagado</label>
            <div class="col-lg-3">
                @Html.TextBoxFor(model => model.EstadoApagado, new {@class = "form-control"})
            </div>

        </div>

        
        <div class="form-group">
            <div class="col-lg-offset-2 col-lg-3">
                <button class="btn btn-primary">Guardar</button>
                <!--ACA AGREGUE ADEMAS DE ACTION ANTES QUE AGRREGUE EL ID EN VEZ ANTES DE LA DEFINICION DE LAS CAJAS
                    PARAR CARGAR LOS OTROS DATOS POR TECLADO-->
                <a class="btn btn-danger" href="@Html.HiddenFor(model => model.Id), @Url.Action("Index") ">Cancelar</a>
            </div>
        </div>

    }        

</div>
</div>


